<?xml version="1.0" encoding="utf-8"?>
<Content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:blueonionsoftware-com:bloget:runtime:data">
  <text>&lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://blueonionsoftware.com/Blog/Images/WindowsLiveWriter/EasyHeaderAccessinASP.NET2.0_131AA/asp-net-powered%5B3%5D.gif" atomicselection="true"&gt;&lt;img style="margin: 0px 0px 0px 10px" height="23" src="http://blueonionsoftware.com/Blog/Images/WindowsLiveWriter/EasyHeaderAccessinASP.NET2.0_131AA/asp-net-powered_thumb%5B1%5D.gif" width="110" align="right"&gt;&lt;/a&gt; Recently, I needed to add a header attribute programmatically to an ASP.NET page. &lt;a href="http://ryanfarley.com/blog/archive/2006/03/24/18930.aspx"&gt;Ryan Farley&lt;/a&gt; posts an excellent article detailing some new &lt;strong&gt;ASP.NET 2.0&lt;/strong&gt; API's that make it easy.  &lt;p&gt;To change a page's title:  &lt;blockquote&gt;&lt;pre&gt;this.Header.Title = "This is the new page title.";&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;To add a style attribute for the page: 
&lt;blockquote&gt;&lt;pre&gt;Style style = new Style();
style.ForeColor = System.Drawing.Color.Navy;
style.BackColor = System.Drawing.Color.LightGray;

// Add the style to the header for the body of the page
this.Header.StyleSheet.CreateStyleRule(style, null, "body");&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;To add a stylesheet to : 
&lt;blockquote&gt;&lt;pre&gt;HtmlLink link = new HtmlLink();
link.Attributes.Add("type", "text/css");
link.Attributes.Add("rel", "stylesheet");
link.Attributes.Add("href", "~/newstyle.css");
this.Header.Controls.Add(link);&lt;/pre&gt;&lt;/blockquote&gt;</text>
  <last_update>2007-07-25T02:56:23.4375Z</last_update>
  <source_title />
  <source_link />
  <comments />
  <references />
  <attachments />
</Content>